package sort.compareble;

public class TestComparable {
    public static void main(String[] args) {
        Student student = new Student();
        student.setAge(20);
        student.setUsername("刘姥姥");

        Student st2 = new Student();
        st2.setUsername("鸡哥");
        st2.setAge(18);

        Comparable max = getMax(st2, student);
        System.out.println(max);

    }

    public static Comparable getMax(Comparable c1, Comparable c2) {
        int i = c1.compareTo(c2);
        if (i >= 0) {
            return c1;
        }else {
            return c2;
        }
    }
}
